WITH FD_DOMAIN_NA_1 AS
  (SELECT ROW_NUMBER() OVER(ORDER BY T.ORDER_NUM ASC) RN ,T.*
  FROM FD_DOMAIN_NA T
  WHERE 1                    =1
<#if (CODE!) != ''>
  AND (INSTR (T.CODE, :CODE )> 0
  OR INSTR (T.NAME, :CODE )    > 0)
</#if>
<#if (SITE_ID!) != ''>
  AND T.SITE_ID              = :SITE_ID
</#if>
  )
SELECT T.*, JS.NAME AS SITE_NA
FROM FD_DOMAIN_NA_1 T
LEFT JOIN FD_SITE JS ON (JS.ID  = T.SITE_ID)
WHERE T.RN BETWEEN :BEGIN__ROW__NUM AND :END__ROW__NUM